/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package recursion;

/**
 *
 * @author parallels
 */
public class Factorial {
    
    public static int cont = 0;
    
    public static int calc (int n) {
        int fact = 1;
        for (int i=2; i <= n; ++i) {
            fact = fact * i;
        }
        return fact;
    }
    
    public static int recursiveCalc (int n) {
        // or con tecla altGR + 1 
        
        ++cont;
        if ((n == 0) || (n == 1)) {
            return 1;
        } else {
            return n * recursiveCalc(n - 1);
        }
        
    }
    
}
